let obj = {}
obj[Symbol.iterator] = function () {
	let index = 1;
	return {
		next() {
			if (index <= 10) {
				return { value: index++, done: false }
			} else {
				return { done: true }
			}
		}
	}
}

let iterator = obj[Symbol.iterator]();
let s = iterator.next();
while (!s.done) {
	console.log(s.value);
	s = iterator.next();
}

for (let i of obj) {
	console.log(i);
}
